<%@ page contentType="text/html;charset=UTF-8"   language="java"  pageEncoding="utf-8"%> 
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="page" uri="/WEB-INF/page"%>
<%@page isELIgnored="false"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <link href="${pageContext.request.contextPath}/static/assets/css/bootstrap.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/font-awesome.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/css/custom-styles.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
</head>
<body>
    <div id="wrapper">
        <div id="page-wrapper" >
          	<div id="page-inner">
			 	<div class="row">
                    <div class="col-md-12">
                        <h1 class="page-header">
                           Broadcast Ticket <small>Broadcast</small>
                        </h1>
                    </div>
              	</div> 
            	<div class="row">
                	<div class="col-md-12">
                    	<div class="panel panel-default">
                        	<div class="panel-heading">
                             		广播管理
                        	</div>
                        	<form action="broadcast" method="post" id="queryForm">
                        	<div>
                       			<p>
                       			<span>用户编号：</span><span><input type="text" name="userCode" value="${dto.userCode }"/></span>
                       			<span>用户昵称：</span><span><input type="text" name="nickname" value="${dto.nickname }"/></span>
                  				<span>状态：
                  					<select  name="state">
                   					    <option value = ""> </option>
                   						<option value = "0" <c:out value="${dto.state == '0' ? 'selected' : ''} "></c:out>>正常</option>
                   						<option value = "1" <c:out value="${dto.state == '1' ? 'selected' : ''} "></c:out>>禁用</option>
                   						<option value = "2" <c:out value="${dto.state == '2' ? 'selected' : ''} "></c:out>>删除</option>
                   						<option value = "3" <c:out value="${dto.state == '3' ? 'selected' : ''} "></c:out>>预发布</option>
                    				</select>
                    			</span>   
                    			<span>类型：
                    				<select  name="type" value="${dto.type }" >
                    					<option value = ""> </option>
                    					<option value = "0" <c:out value="${dto.type == '0' ? 'selected' : ''} "></c:out>>文字</option>
                    					<option value = "1" <c:out value="${dto.type == '1' ? 'selected' : ''} "></c:out>>图片</option>
                    					<option value = "2" <c:out value="${dto.type == '2' ? 'selected' : ''} "></c:out>>视频</option>
                    				</select>
                    			</span>     		
                   				<input type="button" value="查询" onclick="setPageNo(1)">
                   				<input type="reset" value="重置">
                       			</p>
                        	</div>
                     <shiro:hasPermission name="broadcast:create"> 	
    							<a href="${pageContext.request.contextPath}/broadcast/create">新增广播</a><br/>
						 	</shiro:hasPermission> 
                      		<div class="panel-body">
                            	<div class="table-responsive">
                                	<table class="table table-striped table-bordered table-hover" id="dataTables-example">
	                                    <thead>
	                                        <tr>
	                                            <th>用户编号</th>
	                                            <th>用户昵称</th>
	                                            <th>广播类型</th>
	                                            <th>阅读量</th>	
	                                            <th>评论数</th>	        
	                                            <th>发布时间</th>	        
	                                            <th>状态</th>
	                                            <th>操作</th>
	                                        </tr>
	                                    </thead>
                                    	<tbody>
		                                    <c:forEach items="${page.results}" var="ban">
		                                        <tr class="odd gradeX">
		                                            <td class="center">${ban.userCode}</td>
		                                            <td class="center">${ban.nickname}</td>
		                                            <td>
		                                             	<c:choose>
		                                             		<c:when test="${ban.type==0 }">
		                                             			文字
		                                             		</c:when>
		                                             		<c:when test="${ban.type==1 }">
		                                             			图片
		                                             		</c:when>			                                             					                                             	
		                                             		<c:when test="${ban.type==2 }">
		                                             			视频
		                                             		</c:when>			                                             					                                             	
		                                               	</c:choose>
		                                            </td>	
		                                            <td class="center">${ban.readCnt}</td>
		                                            <td class="center">${ban.commentCount}</td>
		                                            <td class="center">${ban.releaseTime} </td>
		                                            <td>
		                                             	<c:choose>
		                                             		<c:when test="${ban.state==0 }">
		                                             			正常
		                                             		</c:when>
		                                             		<c:when test="${ban.state==1 }">
		                                             			禁用
		                                             		</c:when>			                                             					                                             	
		                                             		<c:when test="${ban.state==2 }">
		                                             			删除
		                                             		</c:when>	
		                                             		<c:when test="${ban.state==3 }">
		                                             			预发布
		                                             		</c:when>		                                             					                                             	
		                                               	</c:choose>
		                                            </td>
		                                            <td>
		                                           	<shiro:hasPermission name="broadcast:modify">   
                        								<a href="${pageContext.request.contextPath}/broadcast/modify?id=${ban.id }">详情</a>
                    							 	</shiro:hasPermission>
								              		<shiro:hasPermission name="broadcast:disable"> 
								                        <a href="${pageContext.request.contextPath}/broadcast/disable?id=${ban.id }">禁用</a>
								                  </shiro:hasPermission>   
		                                            </td>		                                            					                
		                                        </tr>
		                                     </c:forEach>
                                    	</tbody>
                                	</table>
                            	</div>
                        	</div>
                        	<p align="right"><page:page page="${page}"/></p>
				            </form>
                    	</div>
                	</div>
				</div>
        	</div>
	    </div>
	</div>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery-1.10.2.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/dataTables/dataTables.bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/static/assets/js/custom-scripts.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/page.js"></script>
    <script>
          $(document).ready(function () {
              /*$('#dataTables-example').dataTable();*/
          });
  	</script>
</body>
</html>
